#include <iostream>
using std::cout;
using std::endl;

class Point
{
public:
    Point()
    /* : _ix(0) */
    /* , _iy(0) */
    {
        cout << "Point()" << endl;
    }

    Point(int x,int y = 1)
    : _ix(x)//const int _ix = x;
    , _iy(y)
    {
        //相当于const int _ix;
        //_ix = x;  //error
        /* _ix = x; */
        /* _iy = y; */
        cout << "Point(int,int)" << endl;
    }

    Point(const Point & rhs)
    : _ix(rhs._ix)
    , _iy(rhs._iy)
    {
        /* cout << "拷贝构造" << endl; */
    }

#if 0
    Point & operator=(const Point & rhs){
        /* cout << "赋值运算符函数" << endl; */
        _ix = rhs._ix;
        _iy = rhs._iy;
        return *this;
    }
#endif

    void print(){
        cout << "(" << _ix
            << "," << _iy
            << ")" << endl;
    }
private:
    const int _ix = 1;
    const int _iy = 1;
};

void test0(){
    //const常量一经初始化就不能再修改其值
    const int num = 1;


    Point pt(5,6);
    Point pt2(3,9);
    Point pt3;

    //如果一个类声明了常量数据成员
    //该类的对象就不能进行常规意义的赋值操作
    /* pt = pt2; */
    pt.print();
    pt2.print();
    pt3.print();
}

int main(void){
    test0();
    return 0;
}
